package com.woniuxy.controller;

import com.woniuxy.entity.CheckProjectManage;
import com.woniuxy.entity.SurgeryManage;
import com.woniuxy.entity.Tde;
import com.woniuxy.service.CheckProjectManageService;
import com.woniuxy.service.SurgeryManageService;
import com.woniuxy.util.PageParam;
import com.woniuxy.util.ResponseData;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/surgery")
public class SurgeryManageController {
    @Resource
    private SurgeryManageService surgeryManageService;

    @PostMapping("/querySurgery")
    public ResponseData<?> querySurgery(@RequestBody PageParam<SurgeryManage> pageParam){
        Assert.notNull(pageParam,"pageParam is not null");
        return surgeryManageService.querySurgery(pageParam);
    }


    @PostMapping("/addSurgery")
    public ResponseData<?> addSurgery(@RequestBody SurgeryManage surgeryManage){
        Assert.notNull(surgeryManage,"surgeryManage is not null");
        return surgeryManageService.addSurgery(surgeryManage);
    }


    @GetMapping("/querySurgeryById/{id}")
    public ResponseData<?> querySurgeryById(@PathVariable("id")Integer id){
        Assert.notNull(id,"id is not null");
        return surgeryManageService.querySurgeryById(id);
    }


    @PostMapping("/updateSurgery")
    public ResponseData<?> updateSurgery(@RequestBody SurgeryManage surgeryManage){
        Assert.notNull(surgeryManage,"surgeryManage is not null");
        return surgeryManageService.updateSurgery(surgeryManage);
    }

    @GetMapping("/deleteSurgeryManage/{id}")
    public ResponseData<?> deleteSurgeryManage(@PathVariable("id")Integer id){
        Assert.notNull(id,"id is not null");
        return surgeryManageService.deleteSurgery(id);
    }

    @PostMapping("queryByDeList")
    public ResponseData<?> queryByDeList(@RequestBody Tde tde){
        return surgeryManageService.queryByDeList(tde);
    }
}
